package cn.itlight.basic.config;


import cn.itlight.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.annotation.WebServlet;

/**
* @Description: 登录拦截器配置类
* @Author: TomLiu
* @Version: 1.0
* @Date:  2022/7/7 16:55
*/
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor) // 指定我们自己的登录拦截器
                .addPathPatterns("/**") // 设置拦截所有
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/fastdfs/**")
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/user/register/**");
    }
}
